﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Esint.JudicialAuction.Model.Schedule
{
    /// <summary>
    /// 一次值班对象
    /// </summary>
    public class OnceWork
    {
        public OnceWork(WorkType WorkType, WorkPlace WorkPlace, DateTime WorkDate)
        {
            this.WorkType = WorkType;
            this.WorkPlace = WorkPlace;
            this.WorkDate = WorkDate;
            this.PersonList = new List<Schedule_UserInfo>();
            this.ScheduleList = new List<Schedule_ShiftsInfo>();
        }

        private DateTime workDate;

        public string WorkDateStr { get; set; }

        public List<Schedule_ShiftsInfo> ScheduleList
        {
            get; set;
        }
        
        /// <summary>
        /// 工作时间
        /// </summary>
        public DateTime WorkDate
        {
            get { return workDate; }
            set
            {
                workDate = value;
                WorkDateStr = workDate.ToString("yyyy-MM-dd");

            }
        }

        private string dayOfWeekStr;

        /// <summary>
        /// 星期几
        /// </summary>
        public string DayOfWeekStr
        {
            get { return dayOfWeekStr; }

            set
            {
                dayOfWeekStr = value;
            }
        }

        private WorkType workType;

        /// <summary>
        /// 值班类型
        /// </summary>
        public WorkType WorkType
        {
            get { return workType; }
            set
            {
                workType = value;
                if (value == WorkType.Daylight)
                {
                    WorkTypeMeaning = "白班";
                }
                else
                {
                    WorkTypeMeaning = "夜班";
                }

            }
        }

        private bool isNeed = true;
        public bool IsNeed { get { return isNeed; } set { isNeed = value; } }

        /// <summary>
        /// 值班类型含义
        /// </summary>
        public string WorkTypeMeaning { get; set; }

        private WorkPlace workPlace;

        /// <summary>
        /// 值班地点
        /// </summary>
        public WorkPlace WorkPlace
        {
            get { return workPlace; }
            set
            {
                workPlace = value;
                if (value == WorkPlace.Center)
                {
                    WorkPlaceMeaning = "中心";
                }
                else
                {
                    WorkPlaceMeaning = "网信办";
                }
            }
        }

        /// <summary>
        /// 值班地点含义
        /// </summary>
        public string WorkPlaceMeaning { get; set; }

        /// <summary>
        /// 本次值班人员
        /// </summary>
        public List<Schedule_UserInfo> PersonList { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < ScheduleList.Count; i++)
            {
                sb.AppendLine(ScheduleList[i].ToString());
            }

            return sb.ToString();
        }
    }
}
